﻿<UserControl x:Class="BookManager.Views.Controls.BookShelfItem"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ctrl="clr-namespace:BookManager.Views.Controls"
             mc:Ignorable="d" Height="142" Margin="3">

    <Border Name="brdBookShelfItem" Width="{Binding DataContext.MySettings.BookShelfItemWidth, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
            VerticalAlignment="Top" HorizontalAlignment="Center"
            BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="2">
        <Grid Name="grdBookShelfItem">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ToolTip>
                <TextBlock Text="{Binding Title, FallbackValue=TITLE}" />
            </Grid.ToolTip>

            <ctrl:BookCover x:Name="bkcovBookShelfItem" />
            <TextBlock Name="txtbBookName" Grid.Row="1" Margin="5,0" Width="{Binding ElementName=brdBookCover, Path=ActualWidth}"
                       Text="{Binding Title, FallbackValue=TITLE}" FontWeight="Bold" />
            <Border Margin="-1,5,7,1.5" Padding="3,1,1,1" Height="25" HorizontalAlignment="Right" VerticalAlignment="Top" 
                    CornerRadius="10,0,8,0" BorderThickness="1" BorderBrush="Red">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Name="txtbRatingStar" Margin="0,0,-5,-3" HorizontalAlignment="Center" VerticalAlignment="Bottom" Panel.ZIndex="9999"
                               FontWeight="Bold" FontSize="15" Text="{Binding PersonalRating, FallbackValue=0}" />
                    <Image Name="imgRatingStar" Stretch="Fill" Source="/BookManager;component/Images/bookmgr_star.png" />
                </StackPanel>
            </Border>
        </Grid>
    </Border>
</UserControl>
